/**
  考试管理
*/
<template>
    <div>
        <div class="edu-page-warp">
            <el-card shadow="never">
                <section>
                    <el-tabs v-model="activeName" @tab-click="handleClick">
                        <el-tab-pane :label="$t('examinationManagement.examination')" name="course">
                            <el-card
                                shadow="never"
                                v-loading="loading"
                                body-style="padding: 24px;"
                                class="card-margin"
                            >
                                <div class="float-left associated-conditional-input">
                                    <KeywordInput
                                        v-model="queryForm.condition.examName"
                                        :placeholder="$t('examinationManagement.examinationNames')"
                                        @enter="onSubmit"
                                    />
                                </div>
                                <div class="edu-opertion-bar sub-title">
                                    <div class="float-right" style="display: flex;">
                                        <el-button type="primary" @click="exportAdd">
                                            {{ $t('examinationManagement.examinationAdd') }}
                                        </el-button>
                                    </div>
                                </div>
                                <edu-table
                                    :pagination="false"
                                    ref="mainTable"
                                    :tooltipEffect="tooltipEffect"
                                    stripe
                                    :data="dataList"
                                    size="mini"
                                    @selection-change="handleSelectionChange"
                                >
                                    <edu-table-column
                                        :label="$t('examinationManagement.examName')"
                                        prop="examName"
                                    ></edu-table-column>
                                    <edu-table-column
                                        :label="$t('examinationManagement.startTime')"
                                        prop="startTime"
                                    ></edu-table-column>
                                    <edu-table-column
                                        :label="$t('examinationManagement.endTime')"
                                        prop="endTime"
                                    ></edu-table-column>
                                    <edu-table-column
                                        :label="$t('examinationManagement.createTime')"
                                        prop="createTime"
                                    ></edu-table-column>
                                    <edu-table-column :label="$t('examinationManagement.releaseStatus')" prop="releaseStatus">
                                        <template slot-scope="scope">
                                            <el-tag
                                                v-if="scope.row.releaseStatus === 1"
                                                type="success"
                                                plain
                                            >
                                                {{ scope.row.releaseStatus | releaseStatus }}
                                            </el-tag>
                                            <el-tag v-else-if="scope.row.releaseStatus === 0" plain>
                                                {{ scope.row.releaseStatus | releaseStatus }}
                                            </el-tag>
                                        </template>
                                    </edu-table-column>
                                    <edu-table-column
                                        :label="$t('examinationManagement.operate')"
                                        fit
                                    >
                                        <template slot-scope="props">
                                            <el-button
                                                type="text"
                                                @click.stop="changeStatus(props.row)"
                                            >
                                                <span
                                                    v-if="
                                                        props.row.releaseStatus === 1 &&
                                                            permitToClose
                                                    "
                                                >
                                                    {{ $t('examinationManagement.unpublish') }}
                                                </span>
                                                <span
                                                    v-else-if="
                                                        props.row.releaseStatus === 0 &&
                                                            permitToOpen
                                                    "
                                                >
                                                    {{ $t('examinationManagement.release') }}
                                                </span>
                                            </el-button>
                                            <el-button
                                                type="text"
                                                v-if="props.row.releaseStatus === 0"
                                                @click.stop="editOutline(props.row)"
                                            >
                                                {{ $t('overseasInstitutions.edit') }}
                                            </el-button>
                                            <el-button
                                                type="text"
                                                v-if="props.row.releaseStatus === 0"
                                                @click.stop="deleteOne(props.row)"
                                            >
                                                {{ $t('overseasInstitutions.delete') }}
                                            </el-button>
                                        </template>
                                    </edu-table-column>
                                </edu-table>
                                <el-row type="flex" class="row-bg" justify="end">
                                    <el-col>
                                        <el-pagination
                                            @size-change="handleSizeChange"
                                            @current-change="handleCurrentChange"
                                            :current-page="queryForm.pageNum_"
                                            :page-sizes="[20, 40, 80, 100]"
                                            :page-size="queryForm.pageSize_"
                                            layout="total, sizes, prev, pager, next, jumper"
                                            :total="queryForm.total_"
                                            style="float:right;margin-top:10px"
                                        ></el-pagination>
                                    </el-col>
                                </el-row>
                            </el-card>
                            <el-dialog
                                @close="addClose"
                                :before-close="beforeClose"
                                :title="titleList"
                                width="60%"
                                :visible.sync="addflag"
                                :show-close="beforeClose"
                                :close-on-click-modal="false"
                                :close-on-press-escape="false"
                            >
                                <examinationAdd
                                    ref="addform"
                                    @cancel-dialog="changeClose"
                                    :dataQueryForm="dataQueryForm"
                                    :showFlag="addflag"
                                    :dataProp="dataProp"
                                    :dataListProp="dataObjit"
                                    @close="
                                        flag => {
                                            addflag = flag
                                        }
                                    "
                                    @affirm-form="addrmForm"
                                ></examinationAdd>
                            </el-dialog>
                            <el-dialog
                                @close="dataEdit = {}"
                                :before-close="editClose"
                                :title="titleList"
                                width="60%"
                                :visible.sync="editflag"
                                :show-close="editClose"
                                :close-on-click-modal="false"
                                :close-on-press-escape="false"
                            >
                                <examinationEdit
                                    ref="editform"
                                    @cancel-eidt="dialogClose"
                                    :dataList="queryForm"
                                    :dataProp="editProp"
                                    :showFlag="editflag"
                                    :dataListProp="dataEdit"
                                    @close="
                                        flag => {
                                            editflag = false
                                        }
                                    "
                                    @affirm-edit="editrmForm"
                                ></examinationEdit>
                            </el-dialog>
                            <edu-export-dialog
                                :disabled="exportButton"
                                :title="$t('message.prompt')"
                                ref="downloadRef"
                                :data="exportResult"
                            ></edu-export-dialog>
                        </el-tab-pane>

                        <el-tab-pane :label="$t('examinationManagement.questionBankManagement')" name="process">
                            <div>
                                <div class="left-part-box">
                                    <el-card
                                        shadow="never"
                                        v-loading="loading"
                                        body-style="padding: 24px;"
                                    >
                                        <div class="edu-opertion-bar sub-title">
                                            <span style="height: 32px;line-height:32px;float-left">
                                                {{$t('examinationManagement.questionBank')}}
                                            </span>
                                            <div class="float-right" style="display: flex;">
                                                <el-button type="primary" @click="addQuestion">
                                                    {{ $t('examinationManagement.bankAdd') }}
                                                </el-button>
                                            </div>
                                        </div>
                                        <el-table
                                            ref="mainTable"
                                            :row-class-name="tableRowClassName"
                                            :data="dataListBank"
                                            @row-click="rowClick"
                                            size="mini"
                                        >
                                            <el-table-column
                                                :label="$t('examinationManagement.categoryName')"
                                                prop="categoryName"
                                            ></el-table-column>
                                            <el-table-column
                                                :label="$t('examinationManagement.operate')"
                                                fit
                                            >
                                                <template slot-scope="props">
                                                    <el-button
                                                        type="text"
                                                        @click="editOutlineBank(props.row)"
                                                    >
                                                        {{ $t('examinationManagement.edit') }}
                                                    </el-button>
                                                    <el-button
                                                        type="text"
                                                        @click="deleteOneBank(props.row)"
                                                    >
                                                        {{ $t('examinationManagement.delete') }}
                                                    </el-button>
                                                </template>
                                            </el-table-column>
                                        </el-table>
                                    </el-card>
                                </div>
                                <div class="right-part-box">
                                    <el-card shadow="never">
                                        <el-row class="bg-white search-bar">
                                            <el-col :span="8">
                                                <KeywordInput
                                                    v-model="questionFrom.condition.questionPoolName"
                                                    :placeholder="$t('examinationManagement.questionBankName')"
                                                    @enter="onSubmitTwo"
                                                ></KeywordInput>
                                            </el-col>
                                            <div class="float-right" style="display: flex;">
                                                <el-button type="primary" @click="addQuestions">
                                                    {{ $t('examinationManagement.BankAdd') }}
                                                </el-button>
                                            </div>
                                        </el-row>
                                        <el-row>
                                            <el-col>
                                                <edu-table
                                                    :data="dataList"
                                                    :pagination="false"
                                                    :selection="false"
                                                    :order="false"
                                                >
                                                    <el-table-column
                                                        :label="$t('examinationManagement.questionName')"
                                                        show-overflow-tooltip
                                                        min-width="100px"
                                                    >
                                                        <template slot-scope="scope">
                                                            <el-button
                                                                type="text"
                                                                @click="questionBank(scope.row)"
                                                            >
                                                                {{ scope.row.questionPoolName }}
                                                            </el-button>
                                                        </template>
                                                    </el-table-column>
                                                    <el-table-column
                                                        :label="$t('examinationManagement.updateTime')"
                                                        prop="updateTime"
                                                        show-overflow-tooltip
                                                        min-width="100px"
                                                    />
                                                    <el-table-column
                                                        :label="$t('examinationManagement.createUserName')"
                                                        show-overflow-tooltip
                                                        prop="createUserName"
                                                    />
                                                    <el-table-column
                                                        :label="$t('examinationManagement.questionNum')"
                                                        show-overflow-tooltip
                                                        prop="questionNum"
                                                    />
                                                    <el-table-column :label="$t('examinationManagement.operate')" width="150">
                                                        <template slot-scope="scope">
                                                            <el-button
                                                                type="text"
                                                                @click="editQuestions(scope.row)"
                                                            >
                                                                {{ $t('examinationManagement.edit') }}
                                                            </el-button>
                                                            <el-button
                                                                type="text"
                                                                @click="deleteQuestions(scope.row)"
                                                            >
                                                                {{ $t('examinationManagement.delete') }}
                                                            </el-button>
                                                            <el-button
                                                                type="text"
                                                                @click="detailsOutline(scope.row)"
                                                            >
                                                                {{ $t('examinationManagement.check') }}
                                                            </el-button>
                                                        </template>
                                                    </el-table-column>
                                                </edu-table>
                                            </el-col>
                                        </el-row>
                                        <el-row type="flex" class="row-bg" justify="end">
                                            <el-col>
                                                <el-pagination
                                                    @size-change="handleSizeChangeTwo"
                                                    @current-change="handleCurrentChangeTwo"
                                                    :current-page="questionFrom.pageNum_"
                                                    :page-sizes="[20, 40, 80, 100]"
                                                    :page-size="questionFrom.pageSize_"
                                                    layout="total, sizes, prev, pager, next, jumper"
                                                    :total="questionFrom.total_"
                                                    style="float:right;margin-top:10px"
                                                ></el-pagination>
                                            </el-col>
                                        </el-row>
                                    </el-card>
                                </div>
                            </div>
                            <!-- 新建题库分类 -->
                            <el-dialog
                                @close="dataObjit = {}"
                                :before-close="beforeCloseTwo"
                                :title="titleList"
                                width="40%"
                                :visible.sync="addClassflag"
                                :show-close="beforeCloseTwo"
                                :close-on-click-modal="false"
                                :close-on-press-escape="false"
                            >
                                <questionAdd
                                    ref="addformTwo"
                                    @cancel-dialog="changeCloseTwo"
                                    :dataQueryForm="dataQueryForm"
                                    :showFlag="addClassflag"
                                    :dataProp="dataProp"
                                    :dataListProp="dataObjit"
                                    @close="
                                        flag => {
                                            addClassflag = flag
                                        }
                                    "
                                    @affirm-bank="addBankForm"
                                ></questionAdd>
                            </el-dialog>
                            <!-- 新建题库名称 -->
                            <el-dialog
                                @close="dataObjitName = {}"
                                :before-close="beforeCloseThree"
                                :title="titleList"
                                width="40%"
                                :visible.sync="addNameflag"
                                :show-close="beforeCloseThree"
                                :close-on-click-modal="false"
                                :close-on-press-escape="false"
                            >
                                <questionNameAdd
                                    ref="addformThree"
                                    @cancel-dialog="changeCloseThree"
                                    :dataQueryForm="dataQueryForm"
                                    :dataQueryName="dataQueryName"
                                    :showFlag="addNameflag"
                                    :dataProp="dataProp"
                                    :dataListPropName="dataObjitName"
                                    @close="
                                        flag => {
                                            addNameflag = flag
                                        }
                                    "
                                    @affirm-name="addNameForm"
                                ></questionNameAdd>
                            </el-dialog>
                        </el-tab-pane>
                    </el-tabs>
                </section>
            </el-card>
        </div>
    </div>
</template>
<script>
var _THIS
import { queryDic } from 'common/src/api/dictionary'
import UTILS from 'common/src/utils/utils'
import examinationAdd from 'common/src/views/academicBehaviorNorms/examination/common/examinationAdd'
import examinationEdit from 'common/src/views/academicBehaviorNorms/examination/common/examinationEdit'
import questionAdd from 'common/src/views/academicBehaviorNorms/examination/common/questionAdd'
import questionNameAdd from 'common/src/views/academicBehaviorNorms/examination/common/questionNameAdd'
// import questionNameView from 'common/src/views/academicBehaviorNorms/examination/questionNameView'
// import questionBankView from 'common/src/views/academicBehaviorNorms/examination/questionBankView'
import examinationManagement from 'common/src/api/academicBehaviorNorms/examination/examinationManagement'

import forumProject from 'common/src/api/academicForums/forumProject'
import templateApi from 'common/src/api/teachingEvaluation/template'
import interAcaConference from 'common/src/api/internationalCommunication/interAcaConference'
import { getALLCollege } from 'common/src/api/internationalExchanges/exchangeCollegeManagement'

export default {
    components: {
        examinationAdd,
        examinationEdit,
        questionAdd,
        questionNameAdd
    },
    data() {
        return {
            tableIndex: 0,
            permitToClose: true,
            permitToOpen: true,
            activeName: 'course',
            name: '',
            indexKey: 1, // 面包屑
            title: '',
            titleList: '',
            fileList: [],
            addflag: false,
            addClassflag: false,
            addNameflag: false,
            editflag: false,
            editClassflag: false,
            editNameflag: false,
            dataQueryForm: {},
            dataQueryName: {},
            dataListObj: {},
            exportButton: false,
            exportResult: null,
            multipleSelection: [],
            // 考试列表查询
            queryForm: {
                pageNum_: 1,
                pageSize_: 20,
                condition: {
                    examName: ''
                }
            },
            // 题库名称列表
            questionFrom: {
                pageNum_: 1,
                pageSize_: 20,
                condition: {
                    categoryId: 0,
                    questionPoolName: ''
                }
            },
            releaseStatus: '',
            dataListProp: {},
            dataListPropName: {},
            dataEdit: [],
            dataProp: '',
            options: {
                title: [],
                sex: [],
                nationId: []
            },
            id: '',
            dataList: [],
            dataListBank: []
        }
    },
    created() {
       _THIS = this;
        this.postExamination(this.queryForm)
    },
    filters: {
        releaseStatus(val) {
            switch (val) {
                case 0:
                    return _THIS.$t('examinationManagement.unpublished')
                case 1:
                    return _THIS.$t('examinationManagement.published')
                default:
                    return val
            }
        }
    },
    mounted() {
        this.getOptions()
        if (this.$route.query.activeName) {
            this.activeName = this.$route.query.activeName
            this.handleClick({
                name: this.activeName
            })
        }
    },
    methods: {
        // 搜索/筛选
        onSubmit() {
            this.queryForm.pageNum_ = 1
            this.postExamination(this.queryForm)
        },
        onSubmitTwo() {
            this.questionFrom.pageNum_ = 1
            this.postListQuestion(this.questionFrom)
        },
        // 切换tab
        handleClick(tab, event) {
            if (tab.name === 'course') {
                this.postExamination(this.queryForm)
            } else if (tab.name === 'process') {
              this.postApproveAgree(this.queryForm)
                // await this.postListQuestion(this.questionFrom)
            }
        },

        // 考试管理查询
        postExamination(date) {
            examinationManagement.listExam(date).then(res => {
                this.queryForm.pageNum_ = res.data.pageNum_
                this.queryForm.pageSize_ = res.data.pageSize_
                this.queryForm.total_ = res.data.total_
                this.dataList = res.data.list
            })
        },

        // 题库分类查询列表左边
        postApproveAgree(date) {
            examinationManagement.listCategory().then(res => {
                this.dataListBank = []
                res.data.forEach(item => {
                    item['cellFillingList'] = [0]
                    this.dataListBank.push(item)
                })
                this.questionFrom.condition.categoryId = this.dataListBank[0].id
                this.postListQuestion(this.questionFrom)
            })
        },

        // 试题库查询列表右边
        postListQuestion() {
            examinationManagement.listQuestionPool(this.questionFrom).then(res => {
                this.questionFrom.pageNum_ = res.data.pageNum_
                this.questionFrom.pageSize_ = res.data.pageSize_
                this.questionFrom.total_ = res.data.total_
                this.dataList = res.data.list
            })
        },
        getOptions() {
            // 筛选条件字典查询
            let data = {
                lang: this.$store.getters.language || 'cn',
                type: 'allChild',
                keys: ['profession', 'G_XBIE', 'G_GJQU']
            }
            queryDic(data).then(res => {
                UTILS.fillSelect(
                    {
                        title: 'profession',
                        sex: 'G_XBIE',
                        nationId: 'G_GJQU' // 国别/地区
                    },
                    res.data,
                    this.options
                )
            })
        },

        // 发布/取消发布考试
        changeStatus(row) {
            examinationManagement
                .changeReleaseStatus({
                    id: row.id,
                    releaseStatus: row.releaseStatus === 1 ? 0 : 1
                })
                .then(res => {
                    if (res.code === 200) {
                        this.$message({
                            type: 'success',
                            message: this.$t('externamExchangeBase.operateSuccessfully')
                        })
                        this.postExamination(this.queryForm)
                    }
                })
        },

        // 新增考试
        exportAdd() {
            this.title = this.$t('graduate.add')
            this.dataProp = '新增'
            this.titleList = this.$t('新建考试')
            this.dataQueryForm = this.queryForm
            this.addflag = true
        },
        // 编辑考试
        editOutline(row) {
            let params = {
                id: row.id
            }
            examinationManagement.getExamDetail(params).then(res => {
                this.title = this.$t('编辑考试')
                this.editProp = '编辑'
                this.titleList = this.$t('编辑考试')
                this.dataEdit = res.data
                this.dataQueryForm = this.queryForm
                this.editflag = true
                this.$nextTick(() => {
                    this.$refs.editform.setData(this.dataEdit)
                })
            })
        },
        // 新增取消
        changeClose(param) {
            this.addflag = param
        },
        // 新增关闭
        beforeClose(param) {
            this.$refs.addform.cancelDialog()
        },
        addClose() {
            this.dataObjit = {}
            this.$refs["addform"].$refs.fff.fff()
        },
        
        // 新增保存（编辑保存）
        addrmForm(param, data, multipleSelection) {
            let list = []
            multipleSelection.forEach(el => {
                list.push({
                    questionPoolId: el.questionPoolId,
                    questionNum: el.questionNum
                })
            })
            multipleSelection = list
            let params = {
                examName: param.examName,
                categoryId: param.categoryName,
                courseCode: param.courseCode,
                startTime: param.datetimerange[0],
                endTime: param.datetimerange[1],
                examSettingList: list
            }
            examinationManagement.addExam(params).then(res => {
                this.$message.success(this.$t('internship.successfully'))
                this.addflag = false
                this.postExamination(data)
                this.$refs.addform.confirmInner()
            })
        },

        // 编辑取消
        dialogClose() {
            this.editflag = false
        },
        // 编辑关闭
        editClose() {
            this.$refs.editform.cancelDialog()
        },

        // 编辑保存
        editrmForm(params, multipleSelection) {
            let list = []
            multipleSelection.forEach(el => {
                list.push({
                    questionPoolId: el.questionPoolId,
                    questionNum: el.questionNum
                })
            })
            multipleSelection = list
            params['examSettingList'] = list
            if (Array.isArray(params.datetimerange) && params.datetimerange.length !== 0) {
                params['startTime'] = params.datetimerange[0]
                params['endTime'] = params.datetimerange[1]
            } else {
                params['startTime'] = ''
                params['endTime'] = ''
            }
            examinationManagement.editExam(params).then(res => {
                this.$message.success(this.$t('internship.successfully'))
                this.editflag = false
                this.postExamination(this.queryForm)
                this.$refs.editform.confirmInner()
            })
        },

        // 考试删除
        deleteOne(row) {
            this.$delConfirm(this.$t('您确定要删除吗？')).then(_ => {
                let param = {
                    id: row.id
                }
                examinationManagement.deleteExam(param).then(res => {
                    if (res.code === 200) {
                        this.$message({
                            type: 'success',
                            message: this.$t('externamExchangeBase.operateSuccessfully')
                        })
                        this.onSubmit()
                    }
                })
            })
        },
        // 多选
        handleSelectionChange(val) {
            this.multipleSelection = val
        },

        // 新增题库分类
        addQuestion() {
            this.title = this.$t('graduate.add')
            this.dataProp = '新增'
            this.titleList = this.$t('新建题库分类')
            this.dataQueryForm = this.queryForm
            this.addClassflag = true
        },
        // 新增题库分类取消
        changeCloseTwo(param) {
            this.addClassflag = param
        },
        //  新增题库分类取消
        beforeCloseTwo(param) {
            this.$refs.addformTwo.cancelDialog()
        },
        // 编辑题库分类
        editOutlineBank(row) {
            let params = {
                id: row.id
            }
            examinationManagement.getBank(params).then(res => {
                this.dataProp = '编辑'
                this.titleList = this.$t('编辑题库分类')
                this.dataObjit = res.data
                this.dataQueryForm = this.queryForm
                this.addClassflag = true
            })
        },
        // 编辑取消
        dialogCloseTwo() {
            this.editClassflag = false
        },
        // 编辑关闭
        editCloseTwo() {
            this.$refs.editformTwo.cancelDialog()
        },
        // 新增题库分类保存（编辑题库分类保存）
        addBankForm(param, data,dataListProp) {
            if (this.dataProp === '编辑') {
                let params = {
                    categoryName: data.cnName,
                    categoryCode: data.dicCode,
                    id: dataListProp.id
                }
                examinationManagement.editCategory(params).then(res => {
                    this.$message.success(this.$t('internship.successfully'))
                    this.addflag = false
                    this.postApproveAgree(this.queryForm)
                    this.$refs.addformTwo.confirmInner()
                })
            } else if (this.dataProp === '新增') {
                let params = {
                    categoryName: data.cnName,
                    categoryCode: data.dicCode
                }
                examinationManagement.addCategory(params).then(res => {
                    this.$message.success(this.$t('internship.successfully'))
                    this.addflag = false
                    this.postApproveAgree(this.queryForm)
                    this.$refs.addformTwo.confirmInner()
                })
            }
        },
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex === this.tableIndex) {
                return 'warning-row'
            }
            return ''
        },
        rowClick(row, column, event) {
            this.questionFrom.condition.categoryId = row.id
               this.questionFrom.pageNum_ = 1
            this.postListQuestion(this.questionFrom)
        },

        // 删除题库分类
        deleteOneBank(row) {
            let param = {
                id: row.id
            }
            this.$delConfirm(this.$t('您确定要删除吗？')).then(_ => {
                examinationManagement.deleteCategory(param).then(res => {
                    if (res.code === 200) {
                        this.$message({
                            type: 'success',
                            message: this.$t('externamExchangeBase.operateSuccessfully')
                        })
                        this.postApproveAgree()
                    }
                })
            })
        },
        // 新增题库名称
        addQuestions() {
            this.title = this.$t('graduate.add')
            this.dataProp = '新增'
            this.titleList = this.$t('新建题库')
            this.dataQueryForm = this.queryForm
            this.dataQueryName = this.dataListBank
            this.addNameflag = true
        },
        // 新增题库名称保存（编辑题库名称保存）
        addNameForm(param, data) {
            if (this.dataProp === '编辑') {
                let params = {
                    questionPoolName: param.questionPoolName,
                    id: param.id,
                    categoryId: this.questionFrom.condition.categoryId
                }
                examinationManagement.editQuestionPool(params).then(res => {
                    this.$message.success(this.$t('internship.successfully'))
                    this.addflag = false
                    this.postListQuestion({
                        ...data,
                        condition: {
                            categoryId: params.categoryId,
                            questionPoolName: ''
                        }
                    })
                    this.$refs.addformThree.confirmInner()
                })
            } else if (this.dataProp === '新增') {
                let params = {
                    questionPoolName: param.questionPoolName,
                    categoryId: this.questionFrom.condition.categoryId
                }
                examinationManagement.addQuestionPool(params).then(res => {
                    this.$message.success(this.$t('internship.successfully'))
                    this.addflag = false
                    this.postListQuestion({
                        ...data,
                        condition: {
                            categoryId: params.categoryId,
                            questionPoolName: ''
                        }
                    })
                    this.$refs.addformThree.confirmInner()
                })
            }
        },
        // 新增题库分类取消
        changeCloseThree(param) {
            this.addNameflag = param
        },
        //  新增题库分类取消
        beforeCloseThree(param) {
            this.$refs.addformThree.cancelDialog()
        },
        // 编辑题库名称
        editQuestions(row) {
            let params = {
                id: row.questionPoolId
            }
            examinationManagement.getQuestionPool(params).then(res => {
                this.dataProp = '编辑'
                this.titleList = this.$t('编辑题库')
                this.dataObjitName = res.data
                this.dataQueryForm = this.queryForm
                this.addNameflag = true
            })
        },
        // 编辑取消
        dialogCloseThree() {
            this.editNameflag = false
        },
        // 编辑关闭
        editCloseThree() {
            this.$refs.editformThree.cancelDialog()
        },
        // 题库名称查看
        detailsOutline(row) {
            this.$router.push({
                path: '/questionNameView',
                query: {
                    id: row
                }
            })
        },
        // 返回主页
        changeExam() {
            this.indexKey = 1
            this.queryForm.pageNum_ = 1
            this.postExamination(this.queryForm)
        },
        // 题库名称删除
        deleteQuestions(row) {
            let param = {
                id: row.questionPoolId
            }
            this.$delConfirm(this.$t('您确定要删除吗？')).then(_ => {
                examinationManagement.deleteQuestionPool(param).then(res => {
                    if (res.code === 200) {
                        this.$message({
                            type: 'success',
                            message: this.$t('externamExchangeBase.operateSuccessfully')
                        })
                        this.onSubmitTwo()
                    }
                })
            })
        },
        // JAVA试题库
        questionBank(row) {
            this.$router.push({
                path: '/questionBankView',
                query: {
                    id: row
                }
            })
        },
        handleSizeChange(val) {
            this.queryForm.pageSize_ = val
            this.queryForm.pageNum_ = 1
            this.postExamination(this.queryForm)
        },

        handleCurrentChange(val) {
            this.queryForm.pageNum_ = val
            this.postExamination(this.queryForm)
        },
        handleSizeChangeTwo(val) {
            this.questionFrom.pageSize_ = val
            this.questionFrom.pageNum_ = 1
            this.postListQuestion(this.questionFrom)
        },

        handleCurrentChangeTwo(val) {
            this.questionFrom.pageNum_ = val
            this.postListQuestion(this.questionFrom)
        }
    }
}
</script>
<style lang="scss" scoped>
.el-table .warning-row {
    background: red;
}

.el-table .success-row {
    background: red;
}
.sub-title {
    margin: 16px 0;
    font-size: 16px;
    color: #000020;
    letter-spacing: 0;
}
.left-part-box,
.right-part-box {
    float: left;
    margin-right: 20px;
}
.left-part-box {
    width: 300px;
    .el-tree {
        min-height: 450px;
    }
}
.right-part-box {
    width: calc(96% - 300px);
    .el-card {
        width: 100%;
        min-height: 450px;
        display: inline-block;
    }
}
.search-bar {
    padding: 16px 0;
}
</style>
